Skip to content

Conversation

@steunix
Copy link

@steunix steunix commented Oct 15, 2025

This relates to...

#4620 (reply in thread)

Rationale

When server is responding with a max-age=0 or no-cache, Undici does not cache the response and subsequent requests do not include if-none-match or if-modified-since headers.

Changes

The function determineStaleAt does not take max-age=0 and no-cache into account, returning undefined in both cases: the caller will ignore the response in regard to the cache handling

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

As per discussion nodejs#4620 (reply in thread)

Returning undefined causes the caller to ignore the result from a caching standpoint: max-age=0 and no-cache should return 0 for "immediately stale".
Copy link
Member

@metcoder95 metcoder95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for it

@steunix
Copy link
Author

steunix commented Oct 16, 2025

Can you add a test for it

Sorry but I don't know the code base enough to even guess at what level to put a test.

Copy link
Contributor

@Uzlopak Uzlopak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets see if the tests are still happy fist

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.92%. Comparing base (dc5802d) to head (cdb292c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4624      +/-   ##
==========================================
- Coverage   92.93%   92.92%   -0.01%     
==========================================
  Files         106      106              
  Lines       33092    33097       +5     
==========================================
+ Hits        30753    30756       +3     
- Misses       2339     2341       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@metcoder95
Copy link
Member

You can put it within the interceptors tests for cache interceptor, attempting to just replicate the behavior described in the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants